/***************************************************************************
 *   Copyright (C) 2011 by The rPem3d developers                           *
 *   elseifkk@users.sf.net                                                 *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef CVCLS_H
#define CVCLS_H

#include <qwidget.h>

int const npix_def=8;
int const msec_def=1000;

class CrystalViewer : public QWidget {
    Q_OBJECT

public:
    CrystalViewer ( QWidget *parent=0, const char *name=0 );
    ~CrystalViewer();

public:
    void initCrystalViewer(int numx, int numy, int *h, int id);
    void startView(void);
    QPixmap *pm;
    int getMaxVal();
    void drawHitPattern();
    int pmtid;

signals:
    void done(int);

private:

    int *hist;
    int nx,ny,np;
    int timerid;
    int msec;

protected:
    void keyPressEvent(QKeyEvent*);
    void paintEvent(QPaintEvent*);
    void timerEvent(QTimerEvent*);
    void closeEvent(QCloseEvent*);
};

#endif
